<@buildNode childs=root.childs parent=root hasComma=false hasPrefix=false/>

<#macro buildNode childs parent hasComma hasPrefix>
${hasPrefix?string("    ","")}{
${hasPrefix?string("    ","")}  "name": "${parent.name}",
${hasPrefix?string("    ","")}  "childs": [
${hasPrefix?string("    ","")}<#t><#if childs?? && (childs?size > 0)><#list childs as child><@buildNode childs=child.childs parent=child hasComma=(child_index!=childs?size-1) hasPrefix=true/></#list></#if><#t>
${hasPrefix?string("    ","")}  ]
${hasPrefix?string("    ","")}}${hasComma?string(",","")}
</#macro>